<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        window.onload=function(){
            //获取目标canvas
            var can=document.querySelector('canvas');
            //获取画笔
            var context=can.getContext('2d');
            //开始路径
            context.beginPath();
            //绘制圆形区域
            context.arc(300,300,200,0,Math.PI,true);
            //关闭路径
            context.closePath();
            //呈现
            // context.stroke();
            //设置填充颜色
            context.fillStyle='pink';
            //填充
            context.fill();

        }
    </script>
</head>
<body>
    <canvas style="border:1px solid red" width="600" height="600"></canvas>
</body>
</html>